#include "string.h"


namespace sy
{

   /* void string::reserve(size_t n)
    {
        if (n > _capacity)
        {
            char* tmp = new char[n + 1];
            strcpy(tmp, _str);
            delete[]_str;
            _str = tmp;
            _capacity = n;
        }
    }*/


    ostream& operator<<(ostream& _cout, sy::string& s)
    {
        for (auto e : s)
        {
            cout << e << " ";
        }
        return _cout;
    }
    // istream& operator>>(istream& _cin, sy::string& s);
    istream& operator>>(istream& _cin, sy::string& s)
    {
        s.clear();
        const int N = 256;
        char buff[N];
        int i = 0;

        char ch;
        //in >> ch;
        ch = _cin.get();
        while (ch != ' ' && ch != '\n')
        {
            buff[i++] = ch;
            if (i == N - 1)
            {
                buff[i] = '\0';
                s += buff;

                i = 0;
            }

            //in >> ch;
            ch = _cin.get();
        }

        if (i > 0)
        {
            buff[i] = '\0';
            s += buff;
        }

        return _cin;
    }
}